<template>
	<view>
		<view v-for="(item,index) in truck_list" :key="item.id" class="truck_item">
			<view class="div_item">
				<view>车牌号<span>{{item.vehicleno}}</span></view>
			</view>
			<view class="div_item">
				<view>驾驶员<span>{{item.driver}}</span></view>
			</view>
			<view class="div_item">
				<view>电话<span>{{item.tel}}</span></view>
			</view>

			<!-- 底部操作菜单 -->
			<view class="op_menu_div">
				<view class="btn_share" @click.stop="onSel(item)">选择</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				truck_list: [],
			}
		},
		methods: {

			// 接口:车辆信息
			async getSelTruck() {
				let uinfo = this.$getUserInfo()
				let res = await this.$get_sel_truck({ memberid: uinfo.company_tms_id, data: '5' })
				console.log('getSelTruck.res = ', res);
				this.truck_list = res.data.reverse()
			},

			// 点击:选择
			onSel(truck) {
				uni.$emit('onSelTruck', { truck })
				uni.navigateBack()
			},

		},

		mounted() {
			this.getSelTruck()
		},

	}
</script>

<style>
	.truck_item {
		margin: 20rpx;
		border: solid 1rpx rgba(0, 0, 0, 0.15);
		border-radius: 10rpx;
	}

	.div_item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 14rpx 14rpx 0 14rpx;
		font-size: 28rpx;
	}

	span {
		/* display: block; */
		margin: 0 0 0 10rpx;
		color: #1890FF;
		font-size: 26rpx;
	}

	.op_menu_div {
		display: flex;
		justify-content: flex-end;
		padding: 14rpx;
	}

	.btn_share {
		background-color: #1890FF;
		width: 118rpx;
		height: 52rpx;
		line-height: 52rpx;
		text-align: center;
		font-size: 24rpx;
		color: white;
		border-radius: 4rpx;
		margin: 0 0 0 12rpx;
	}
</style>